# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=mlt
pkgver=7.24.0
pkgrel=0
pkgdesc="MLT Multimedia Framework"
url="https://www.mltframework.org/"
arch="all"
license="GPL-2.0-or-later AND LGPL-2.1-or-later AND GPL-3.0-or-later"
makedepends="
	cmake
	ffmpeg-dev
	fftw-dev
	frei0r-plugins-dev
	gtk+2.0-dev
	jack-dev
	ladspa-dev
	libarchive-dev
	libexif-dev
	libsamplerate-dev
	libvorbis-dev
	libxml2-dev
	python3-dev
	qt5-qtbase-dev
	qt5-qtsvg-dev
	qt6-qt5compat-dev
	qt6-qtbase-dev
	qt6-qtsvg-dev
	samurai
	sdl2-dev
	sox-dev
	swig
	vidstab-dev
	"
options="!check" # todo
checkdepends="py3-pykwalify"
subpackages="$pkgname-dev $pkgname-doc py3-$pkgname:py3"
source="https://github.com/mltframework/mlt/releases/download/v$pkgver/mlt-$pkgver.tar.gz"

case $CARCH in
ppc64le|s390x|riscv64)
	_opencv=OFF
	;;
*)
	makedepends="$makedepends opencv-dev"
	_opencv=ON
	;;
esac

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_SKIP_INSTALL_RPATH=ON \
		-DBUILD_TESTING=OFF \
		-DMOD_OPENCV=$_opencv \
		-DMOD_MOVIT=OFF \
		-DMOD_PLUS=OFF \
		-DMOD_RTAUDIO=OFF \
		-DMOD_RUBBERBAND=OFF \
		-DMOD_QT6=ON \
		-DMOD_GLAXNIMATE=ON \
		-DSWIG_PYTHON=ON
	cmake --build build
}

package() {
	cd build

	DESTDIR="$pkgdir" cmake --install .
}

py3() {
	pkgdesc="$pkgdesc (Python bindings)"

	amove usr/lib/python*
}

sha512sums="
a9e7fd5dc04152e523456bad244416b4fdeb5961ee7cadb816dd1393277d1d801200db595dcd28e520d76e6b2caca17e65c39b0256beb7c42a58ef241b85471d  mlt-7.24.0.tar.gz
"
